import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'//生成 svg 雪碧图
import path from 'path'
// https://vite.dev/config/
export default defineConfig({
  plugins: [react(),createSvgIconsPlugin({
    iconDirs: [path.resolve(process.cwd(), 'src/assets/svg')],
    symbolId: 'icon-[dir]-[name]',
  }),],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, 'src'),
    },
  },
  
  server: {
    port: 8080,
    host: true,
    hmr:true,
    // proxy: {
    //   '/api': {
    //     target: 'http://localhost:8080', // 你的后端服务地址
    //     changeOrigin: true,
    //     rewrite: (path) => path.replace(/^\/api/, ''),
    //   },
    // },
  },

 
})
